package com.jackrain.nea.omslocal.conf;

import com.alibaba.fastjson.JSONArray;
import com.jackrain.nea.web.query.QueryEngine;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ：wcy
 * @date ：Created in 18:07 2018/8/8
 * description ：缓存客户所有的店铺名称
 */
@Component
@Slf4j
@Order(2)
public class LoadSellerNickConfig implements CommandLineRunner{
    /**
     * 店铺信息Map
     * */
    public static Map<String,Object> sellerNickInfoMap = new HashMap<>();

    @Override
    public void run(String... strings) throws Exception {
        String sql = "select SELLERNICK from t_iesshop where platform = 2";
        JSONArray sellerNickArr = QueryEngine.getInstance().doQueryObjectArray(sql);
        sellerNickInfoMap.put("sellerNickArr",sellerNickArr);
        log.debug("淘宝店铺信息缓存成功！！！");
    }
}
